package com.chf.job.service.impl;

import com.chf.job.dao.DeliverMapper;
import com.chf.job.pojo.Deliver;
import com.chf.job.service.DeliverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeliverServiceImpl implements DeliverService {
    @Autowired
    private DeliverMapper deliverMapper;

    /**
     * 添加简历
     * @param deliver
     * @param email
     * @return
     */
    @Override
    public int addDeliver(Deliver deliver, String email) {
        Deliver newDeliver = new Deliver();
        newDeliver.setCompanyId(deliver.getCompanyId());
        newDeliver.setDeliverEmail(email);
        newDeliver.setCompanyEmail(deliver.getCompanyEmail());
        newDeliver.setResumeStatus(1);
        return deliverMapper.insertSelective(newDeliver);
    }

    /**
     * 查询未处理的简历
     * @param email
     * @return
     */
    @Override
    public List<Deliver> getByCompanyEmail(String email) {
        return deliverMapper.getByCompanyEmail(email);
    }

    /**
     * 通知面试
     * @param email
     * @param status
     * @return
     */
    @Override
    public int updateDeliverStatus(String email, Integer status,  String companyEmail) {

        return deliverMapper.updateDeliverStatus(email, status, companyEmail);
    }

    /**
     * 查看已通知的简历
     * @param email
     * @return
     */
    @Override
    public List<Deliver> getByCompanyEmailAndStatus(String email) {
        return deliverMapper.getByCompanyEmailAndStatus(email);
    }

    /**
     * 查看不合适的简历
     * @param email
     * @return
     */
    @Override
    public List<Deliver> getByCompanyEmailStatus(String email) {
        return deliverMapper.getByCompanyEmailStatus(email);
    }

}
